<template>
    <div>
        <el-breadcrumb separator-class="el-icon-arrow-right">
            <el-breadcrumb-item :to="{ path: '/admin/home' }"
              >首页</el-breadcrumb-item
            >
            <el-breadcrumb-item>用户管理</el-breadcrumb-item>
            <el-breadcrumb-item>所有用户</el-breadcrumb-item>
            <!-- <el-button @click="getAllusers(true)">get</el-button> -->
          </el-breadcrumb>
        <el-table
            :data="dataList"
            style="width: 100%"
            height="600">
            <el-table-column
                label="操作"
                sortable
                prop="Rtype">
                <template slot-scope="{row}" >
                    {{ transfer(row.Rtype) }}
                  </template>
            </el-table-column>
            <el-table-column label="时间" prop="Rtime"></el-table-column>
            <!-- <el-table-column label="身份" prop="Ukind">
                <template slot-scope="{row}" >
                    {{ transferKind(row.Ukind) }}
                  </template>
            </el-table-column> -->
            <el-table-column label="ID" prop="Rid">
                <template slot-scope="{row}" >
                    {{ transferID(row.Rid) }}
                  </template>
            </el-table-column>
        </el-table>
        总共{{this.dataList.length}}条日志记录
    </div>
</template>
<script>
import axios from 'axios'
    export default {
      data() {
        return {
            dataForm:{
                Rtype : 0,
                Rtime : '',
                Rid : 0,
                Ukind : 0,
                Utele : '',
                Uname : '',
                Usex : 0,
                Upwd : '',
                Uimg : '',
                Uaddr : '',
                Fid : 0,
                Fname : '',
                Fprice : '',
                Fimg : '',
                Fdesc : '',
                Fstock : 0,
                Ftype : '',
                Frec : 0,
                Fstatus : '',
                Oid : 0,
                Ostatus : '',
                Bid : 0,
                Otip : ''
            },
            dataList:[],
      }},
      created() {
        this.getAllusers()
      },
      methods:{
        async getAllusers(search) {
                var query = {}
                axios.post(`/log/getall`,query)
                .then((res) => { 
                  console.log("get all log")
                  this.dataList = res.data;
                  console.log("res.data")
                  console.log(this.dataList)

                  if (res.status !== 200) return this.$message.error('获取列表失败')
                })
        },
        transfer(s){
            if(s === 1) {
                return "用户注册"
            }else if(s === 2) {
                return "修改密码"
            } else if (s === 3) {
                return "添加菜品"
            } else if(s === 4) {
                return "修改菜品"
            } else if(s === 5) {
                return "删除菜品"
            } else if(s === 6) {
                return "修改订单状态"
            } else if(s === 7) {
                return "删除订单"
            } else if(s === 8){
                return "提交购物车"
            } else if( s === 9){
                return "购物车加入菜品"
            } else if(s === 10) {
                return "购物车减少菜品"
            } else if( s=== 11) {
                return "删除用户"
            } else if(s === 12) {
                return "通过用户"
            }else if(s === 13) {
                return "通过菜品"
            }else if(s === 14) {
                return "删除菜品"
            }else if(s === 15) {
                return "通过订单"
            }else if(s === 16) {
                return "删除订单"
            }
        },
        transferKind(s){
            console.log(s)
            if(s === 0) return "商家"
            else if(s=== 1) return "顾客"
            else return "未标注"
        },
        transferID(s) {
            // console.log(s)
            if(s == null) return "0"
            else return s
        }
       
    }}
</script>
